<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qclvector.cpp -->
  <title>QCLVector Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <script src="./scripts/superfish.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />  <script src="./scripts/narrow.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->
</head>
<body class="" onload="CheckEmptyAndLoadList();">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="150"><img src="images/qt-logo.png" align="left" border="0" />&nbsp;&nbsp;<img src="images/qtopencl-logo.png" border="0" /></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"> <a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="qtopencl-all-classes.html"><font color="#004faf">All Classes</font></a></td>
</table>              <li><a href="modules.html">Modules</a></li>              <li>QtCL</li>
              <li>QCLVector</li>
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<h1 class="title">QCLVector Class Reference</h1>
<!-- $$$QCLVector-brief -->
<p>The QCLVector class represents a typed OpenCL buffer object. <a href="#details">More...</a></p>
<!-- @@@QCLVector -->
<pre class="highlightedCode brush: cpp">    #include &lt;QCLVector&gt;</pre><p>This class was introduced in QtOpenCL 4.7.</p>
<ul>
<li><a href="qclvector-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qclvector.html#QCLVector">QCLVector</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qclvector.html#QCLVector-2">QCLVector</a></b> ( const QCLVector&lt;T&gt; &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qclvector.html#dtor.QCLVector">~QCLVector</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QCLContext * </td><td class="memItemRight bottomAlign"><b><a href="qclvector.html#context">context</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qclvector.html#isEmpty">isEmpty</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qclvector.html#isNull">isNull</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qclvector.html#read">read</a></b> ( T * <i>data</i>, int <i>count</i>, int <i>offset</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qclvector.html#release">release</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qclvector.html#size">size</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QCLBuffer </td><td class="memItemRight bottomAlign"><b><a href="qclvector.html#toBuffer">toBuffer</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qclvector.html#write">write</a></b> ( const T * <i>data</i>, int <i>count</i>, int <i>offset</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qclvector.html#write-2">write</a></b> ( const QVector&lt;T&gt; &amp; <i>data</i>, int <i>offset</i> = 0 )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QCLVector&lt;T&gt; &amp; </td><td class="memItemRight bottomAlign"><b><a href="qclvector.html#operator-eq">operator=</a></b> ( const QCLVector&lt;T&gt; &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> T &amp; </td><td class="memItemRight bottomAlign"><b><a href="qclvector.html#operator-5b-5d">operator[]</a></b> ( int <i>index</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const T &amp; </td><td class="memItemRight bottomAlign"><b><a href="qclvector.html#operator-5b-5d-2">operator[]</a></b> ( int <i>index</i> ) const</td></tr>
</table>
<a name="details"></a>
<!-- $$$QCLVector-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QCLVector class represents a typed OpenCL buffer object.</p>
<p>QCLVector is a convenience template class that wraps an OpenCL buffer object to make it appear as a host-accessible array of elements of type T.</p>
<p>Whenever the host CPU calls operator[](), the array's contents are copied into host-accessible memory for direct access. When the host sets the vector on a <a href="qclkernel.html">QCLKernel</a> as an argument, the data is copied back to the OpenCL compute device (e.g&#x2e;, the GPU).</p>
<p>The type T is restricted to primitive and movable types that do not require explicit construction, destruction, or operator=(). T can have constructors, but they will not be called. This is because the data will be copied to the OpenCL device in a different address space, and the OpenCL device will not know how to construct, destruct, or copy the data in a C++-compatible manner.</p>
<p>Types such as float, char, int, QPointF, and QVector3D can be used as the type T, but types such as QString cannot.</p>
</div>
<!-- @@@QCLVector -->
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QCLVector[overload1]$$$QCLVector -->
<h3 class="fn"><a name="QCLVector"></a>QCLVector::QCLVector ()</h3>
<p>Creates a null OpenCL vector.</p>
<p>See also <a href="qclvector.html#isNull">isNull</a>().</p>
<!-- @@@QCLVector -->
<!-- $$$QCLVector$$$QCLVectorconstQCLVector<T>& -->
<h3 class="fn"><a name="QCLVector-2"></a>QCLVector::QCLVector ( const QCLVector&lt;T&gt; &amp; <i>other</i> )</h3>
<p>Creates a copy of the <i>other</i> vector reference. The vector's contents are not duplicated: modifications to this vector will also affect <i>other</i>.</p>
<p>See also <a href="qclvector.html#operator-eq">operator=</a>().</p>
<!-- @@@QCLVector -->
<!-- $$$~QCLVector[overload1]$$$~QCLVector -->
<h3 class="fn"><a name="dtor.QCLVector"></a>QCLVector::~QCLVector ()</h3>
<p>Destroys this vector reference. If this is the last reference to the underlying data, the vector will be unmapped and deallocated.</p>
<!-- @@@~QCLVector -->
<!-- $$$context[overload1]$$$context -->
<h3 class="fn"><a name="context"></a><a href="qclcontext.html">QCLContext</a> * QCLVector::context () const</h3>
<p>Returns the OpenCL context that was used to create this vector.</p>
<!-- @@@context -->
<!-- $$$isEmpty[overload1]$$$isEmpty -->
<h3 class="fn"><a name="isEmpty"></a>bool QCLVector::isEmpty () const</h3>
<p>Returns true if this OpenCL vector is empty; false otherwise.</p>
<!-- @@@isEmpty -->
<!-- $$$isNull[overload1]$$$isNull -->
<h3 class="fn"><a name="isNull"></a>bool QCLVector::isNull () const</h3>
<p>Returns true if this vector is null; false otherwise.</p>
<!-- @@@isNull -->
<!-- $$$read[overload1]$$$readT*intint -->
<h3 class="fn"><a name="read"></a>void QCLVector::read ( T * <i>data</i>, int <i>count</i>, int <i>offset</i> = 0 )</h3>
<p>Reads the <i>count</i> elements starting <i>offset</i> in this vector into <i>data</i>.</p>
<p>See also <a href="qclvector.html#write">write</a>().</p>
<!-- @@@read -->
<!-- $$$release[overload1]$$$release -->
<h3 class="fn"><a name="release"></a>void QCLVector::release ()</h3>
<p>Releases the contents of this OpenCL vector. If not explicitly released, the contents will be implicitly released when the vector is destroyed.</p>
<!-- @@@release -->
<!-- $$$size[overload1]$$$size -->
<h3 class="fn"><a name="size"></a>int QCLVector::size () const</h3>
<p>Returns the number of elements of type T in this OpenCL vector.</p>
<!-- @@@size -->
<!-- $$$toBuffer[overload1]$$$toBuffer -->
<h3 class="fn"><a name="toBuffer"></a><a href="qclbuffer.html">QCLBuffer</a> QCLVector::toBuffer () const</h3>
<p>Returns the OpenCL buffer handle for this vector.</p>
<!-- @@@toBuffer -->
<!-- $$$write[overload1]$$$writeconstT*intint -->
<h3 class="fn"><a name="write"></a>void QCLVector::write ( const T * <i>data</i>, int <i>count</i>, int <i>offset</i> = 0 )</h3>
<p>Writes the <i>count</i> elements from <i>data</i> to <i>offset</i> in this vector.</p>
<p>See also <a href="qclvector.html#read">read</a>().</p>
<!-- @@@write -->
<!-- $$$write$$$writeconstQVector<T>&int -->
<h3 class="fn"><a name="write-2"></a>void QCLVector::write ( const QVector&lt;T&gt; &amp; <i>data</i>, int <i>offset</i> = 0 )</h3>
<p>This is an overloaded function.</p>
<p>Writes the contents of <i>data</i> to <i>offset</i> in this vector.</p>
<!-- @@@write -->
<!-- $$$operator=[overload1]$$$operator=constQCLVector<T>& -->
<h3 class="fn"><a name="operator-eq"></a>QCLVector&lt;T&gt; &amp; QCLVector::operator= ( const QCLVector&lt;T&gt; &amp; <i>other</i> )</h3>
<p>Assigns the <i>other</i> vector reference to this object. The vector's contents are not duplicated: modifications to this vector will also affect <i>other</i>.</p>
<!-- @@@operator= -->
<!-- $$$operator[][overload1]$$$operator[]int -->
<h3 class="fn"><a name="operator-5b-5d"></a>T &amp; QCLVector::operator[] ( int <i>index</i> )</h3>
<p>Returns a reference to the element at <i>index</i> in this OpenCL vector. The vector will be copied to host memory if necessary.</p>
<!-- @@@operator[] -->
<!-- $$$operator[]$$$operator[]int -->
<h3 class="fn"><a name="operator-5b-5d-2"></a>const T &amp; QCLVector::operator[] ( int <i>index</i> ) const</h3>
<p>Returns a const reference to the element at <i>index</i> in this OpenCL vector. The vector will be copied to host memory if necessary.</p>
<!-- @@@operator[] -->
</div>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td align="left">Copyright &copy; 2010 Nokia Corporation</td>
<td align="right">QtOpenCL Documentation</td>
</tr></table></div></address>  <script src="scripts/functions.js" type="text/javascript"></script>
  <script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-4457116-5']);
  _gaq.push(['_trackPageview']);
  (function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
  </script>
</body>
</html>
